<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8" name="author" content="20201212杨铖宇">
    <title>Login</title>
    <!-- 引入css、js -->
    <link rel="stylesheet" href="css/login.css">
    <script src="js/login.js"></script>
    <script src="js/jquery.min.js"></script>
</head>
<body>
	<!--背景变换-->
    <div class="slideshow">
        <div class="slideshow-image" style="background-image: url('img/wallhaven1.png')"></div>
        <div class="slideshow-image" style="background-image: url('img/wallhaven3.png')"></div>
        <div class="slideshow-image" style="background-image: url('img/wallhaven4.png')"></div>
        <div class="slideshow-image" style="background-image: url('img/wallhaven5.png')"></div>
    </div>
    <!--导航栏-->
    <ul>
      <li><a class="active" href="https://ycy20201212.github.io/">Home</a></li>
      <li><a href="https://www.sohu.com/">News</a></li>
      <li><a href="https://www.cnblogs.com/20201212ycy/">Contact</a></li>
      <li style="float:right"><a href="About.html">About</a></li>
    </ul>
    <!-- 搭建结构 -->
    <div class="container switch">
        <!-- 注册页面Register -->
        <div class="container-form container-signup">
            <form action="Register" class="form">
                <h1 class="form-title">注册</h1>
                <input type="text" placeholder="用户名" class="input" id="username" name="username">
                <input type="text" placeholder="学号" class="input" id="id" name="id">
                <input type="text" placeholder="姓名" class="input" id="realname" name="realname">
                <input type="password" placeholder="密码" class="input" id="password" name="password">
                <button class="submit-2" onclick="checkRegister()">注册</button>
            </form>
        </div>
        <!-- 登录页面Login -->
        <%
        	//此地方写java代码
        	//获取错误信息
        	String errorinfo=null;
        	errorinfo=request.getParameter("error");
        	if("3".equals(errorinfo)){%>
				<script type="text/javascript" language="javascript">
				alert("用户名不存在");			// 弹出错误信息
				window.location='login.jsp';	// 跳转到登录界面
				</script>
        	<%
        	}else if("2".equals(errorinfo)){%>
				<script type="text/javascript" language="javascript">
				alert("密码错误");				// 弹出错误信息
				window.location='login.jsp';	// 跳转到登录界面
				</script>
    		<%
        	}else if("1".equals(errorinfo)){%>
				<script type="text/javascript" language="javascript">
				alert("用户名密码错误");			// 弹出错误信息
				window.location='login.jsp';	// 跳转到登录界面
				</script>
    		<%
        	}else if("4".equals(errorinfo)){%>
				<script type="text/javascript" language="javascript">
				alert("用户名已存在");			// 弹出错误信息
				window.location='login.jsp';	// 跳转到登录界面
				</script><%
			}
        %>
        <div class="container-form container-signin">
            <form action="login" class="form" method="POST">
                <h1 class="form-title">登录</h1>
                <input type="text" placeholder="用户名" class="input" name="username" maxlength="10" value="20201212">
                <input type="password" placeholder="密码" class="input" name="password" value="201212">
                <a href="Retrieve.jsp">忘记密码?</a>
                <input type="submit" class="submit-2" value="登录">
            </form>
        </div>
        <!-- 覆盖层 -->
        <div class="container-overlay">
            <div class="overlay">
                <div class="overlay-slide overlay-left">
                    <button class="submit-1" id="goSignIn">登录</button>
                </div>
                <div class="overlay-slide overlay-right">
                    <button class="submit-1" id="goSignUp">注册</button>
                </div>
            </div>
        </div>
    </div>
</body>
</html>